﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControlDatHang.ascx.cs" Inherits="WebUserControlDatHang" %>
<style type="text/css">
    .auto-style1 {
        width: 100%;
    }

    .auto-style2 {
        width: 801px;
        height: 25px;
    }

    .auto-style3 {
        height: 25px;
    }
</style>

<script type="text/javascript">

    jQuery(function () {

    });

    function showPopup(orderID) {
        jQuery.ajax({
            type: "POST",
            url: "WebUserControlDatHang.ascx/GetOrderDetail",
            data: "{'orderID': '" + orderID + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            beforeSend: function () {
                    
            },
            success: function (data) {
                try {
                    if (data!=null) {
                        alert(data.d.length);
                    }
                } catch (e) {

                }
            },
            error: function (data, status, e) {
                alert(e);
            }
        });

        jQuery("#dialog").dialog();
    }

    </script>
<div style="width: 100%">
    <table class="auto-style1">
        <tr>
            <td class="auto-style2"></td>
            <td class="auto-style3">
                <asp:CheckBox ID="cbxHienThi" runat="server" Text="Hiện tất cả đơn đặt hàng" AutoPostBack="True" Checked="True" OnCheckedChanged="cbxHienThi_CheckedChanged" />
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <asp:GridView ID="gdvDatHang" runat="server" AutoGenerateColumns="False" CellPadding="3" Width="100%" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" OnRowEditing="gdvDatHang_RowEditing" HeaderStyle-Height="30px" RowStyle-Height="30px" OnSelectedIndexChanged="gdvDatHang_SelectedIndexChanged">
                    <Columns>
                        <asp:TemplateField HeaderText="Tài khoản đặt hàng">
                            <ItemTemplate>
                                <asp:Label ID="lblTaiKhoan" runat="server" Text='<%# Eval("TaiKhoan.TenTK") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Ngày đặt hàng">
                            <ItemTemplate>
                                <asp:Label ID="lblNgayDatHang" runat="server" Text='<%# Eval("NgayDatHang") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Tổng giá trị">
                            <ItemTemplate>
                                <asp:Label ID="lblTongGiaTri" runat="server" Text='<%# Eval("TongTien") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Người nhận">
                            <ItemTemplate>
                                <asp:Label ID="lblNguoiNhan" runat="server" Text='<%# Eval("TenNguoiNhan") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Số điện thoại">
                            <ItemTemplate>
                                <asp:Label ID="lblSoDienThoai" runat="server" Text='<%# Eval("SoDienThoai") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Địa chỉ giao hàng">
                            <ItemTemplate>
                                <asp:Label ID="lblDiaChiGiao" runat="server" Text='<%# Eval("DiaChi") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Trạng thái">
                            <ItemTemplate>
                                <asp:Label ID="lblTrangThai" runat="server" Text='<%# Eval("TrangThai") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Ngày giao hàng">
                            <ItemTemplate>
                                <asp:Label ID="lblNgayGiaoHang" runat="server" Text='<%# Eval("NgayGiaoHang") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <ItemTemplate>
                               <%-- <asp:Button ID="btnChiTiet" runat="server" CommandName="Edit" Text="Xem chi tiết" CommandArgument='<%# Eval("MaPhieu") %>'
                                    OnClientClick='showPopup();return false();' UseSubmitBehavior="false" OrderID='<%#Eval("MaPhieu") %>'/>--%>
                                <input type="button" value="Xem chi tiết" onclick='showPopup(<%#Eval("MaPhieu") %>);' />
                                &nbsp;
                                    <asp:Button ID="btnGiaoHang" runat="server" CommandName="Giaohang" Text="Giao hàng" />
                                <br />
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Bị trả lại" Width="91px" />
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <FooterStyle BackColor="White" ForeColor="#000066" />
                    <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
                    <RowStyle ForeColor="#000066" />
                    <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
                    <SortedAscendingCellStyle BackColor="#F1F1F1" />
                    <SortedAscendingHeaderStyle BackColor="#007DBB" />
                    <SortedDescendingCellStyle BackColor="#CAC9C9" />
                    <SortedDescendingHeaderStyle BackColor="#00547E" />
                </asp:GridView>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                &nbsp;</td>
        </tr>
    </table>
    <%--<asp:Panel ID="pnlChiTiet" runat="server" Visible="false">
        <asp:GridView ID="gdvChiTiet" runat="server" AutoGenerateColumns="False" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3" Width="823px">
            <Columns>
                <asp:TemplateField HeaderText="Hình">
                    <ItemTemplate>
                        <asp:Image ID="Image1" runat="server" ImageUrl='<%# "Images/"+Eval("Sach.Hinh") %>' Height="49px" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Tên sách">
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("Sach.TenSach") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Số lượng">
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Eval("SoLuong") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Đơn giá">
                    <ItemTemplate>
                        <asp:Label ID="Label3" runat="server" Text='<%# Eval("DonGia") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <FooterStyle BackColor="White" ForeColor="#000066" />
            <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
            <RowStyle ForeColor="#000066" />
            <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
            <SortedAscendingCellStyle BackColor="#F1F1F1" />
            <SortedAscendingHeaderStyle BackColor="#007DBB" />
            <SortedDescendingCellStyle BackColor="#CAC9C9" />
            <SortedDescendingHeaderStyle BackColor="#00547E" />
        </asp:GridView>
    </asp:Panel>--%>

    
    <div id="dialog" title="Basic dialog" style="display: none">
        <p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
    </div>
</div>

